package com.gray.serverclientuser.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created on 2019/6/21.
 *
 * @author Grak
 * @since 1.0
 */
@RestController
@RefreshScope
public class UserMsgController {


    @Value("${server.port}")
    private int port;

    @Value("${msg.name}")
    private String msg;

    @RequestMapping("/findById")
    public String findById(@RequestBody int id) {

        if (id == 1) {
            return "李斯";
        } else if (id == 2) {
            return "宙斯";
        }
        int ss = 2 / 0;
//        try {
//            Thread.sleep(4000);
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }
        return "没有找到！！";
    }

    @RequestMapping("/port")
    public String getPort() {
        return "order-port:" + port + "msg:" + msg;
    }
}
